@plasmicpkgs/plasmic-rich-components 1.0.169 → 1.0.170
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/.tsbuildinfo +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/plasmic-rich-components.esm.js +7 -7
- package/dist/plasmic-rich-components.esm.js.map +1 -1
- package/dist/rich-calendar/index.d.ts +1 -1
- package/package.json +18 -4
- package/skinny/common-8cca2977.esm.js +22 -0
- package/skinny/common-8cca2977.esm.js.map +1 -0
- package/skinny/common-e1d76791.cjs.js +30 -0
- package/skinny/common-e1d76791.cjs.js.map +1 -0
- package/skinny/common-prop-types-5f1fd4b0.cjs.js +139 -0
- package/skinny/common-prop-types-5f1fd4b0.cjs.js.map +1 -0
- package/skinny/common-prop-types-686c49fe.esm.js +133 -0
- package/skinny/common-prop-types-686c49fe.esm.js.map +1 -0
- package/skinny/common-prop-types.d.ts +12 -0
- package/skinny/common.d.ts +5 -0
- package/skinny/field-mappings.d.ts +100 -0
- package/skinny/field-react-utils-26fba31e.esm.js +142 -0
- package/skinny/field-react-utils-26fba31e.esm.js.map +1 -0
- package/skinny/field-react-utils-c717ec94.cjs.js +153 -0
- package/skinny/field-react-utils-c717ec94.cjs.js.map +1 -0
- package/skinny/field-react-utils.d.ts +34 -0
- package/skinny/formatting-327e0658.cjs.js +645 -0
- package/skinny/formatting-327e0658.cjs.js.map +1 -0
- package/skinny/formatting-aff39488.esm.js +633 -0
- package/skinny/formatting-aff39488.esm.js.map +1 -0
- package/skinny/formatting.d.ts +7 -0
- package/skinny/rich-calendar/RichCalendar.d.ts +31 -0
- package/skinny/rich-calendar/index.cjs.js +501 -0
- package/skinny/rich-calendar/index.cjs.js.map +1 -0
- package/skinny/rich-calendar/index.d.ts +15 -0
- package/skinny/rich-calendar/index.esm.js +488 -0
- package/skinny/rich-calendar/index.esm.js.map +1 -0
- package/skinny/rich-details/RichDetails.d.ts +12 -0
- package/skinny/rich-details/index.cjs.js +169 -0
- package/skinny/rich-details/index.cjs.js.map +1 -0
- package/skinny/rich-details/index.d.ts +3 -0
- package/skinny/rich-details/index.esm.js +162 -0
- package/skinny/rich-details/index.esm.js.map +1 -0
- package/skinny/rich-layout/RichLayout.d.ts +22 -0
- package/skinny/rich-layout/index.cjs.js +486 -0
- package/skinny/rich-layout/index.cjs.js.map +1 -0
- package/skinny/rich-layout/index.d.ts +5 -0
- package/skinny/rich-layout/index.esm.js +476 -0
- package/skinny/rich-layout/index.esm.js.map +1 -0
- package/skinny/rich-list/RichList.d.ts +59 -0
- package/skinny/rich-list/index.cjs.js +583 -0
- package/skinny/rich-list/index.cjs.js.map +1 -0
- package/skinny/rich-list/index.d.ts +5 -0
- package/skinny/rich-list/index.esm.js +571 -0
- package/skinny/rich-list/index.esm.js.map +1 -0
- package/skinny/rich-table/RichTable.d.ts +46 -0
- package/skinny/rich-table/index.cjs.js +598 -0
- package/skinny/rich-table/index.cjs.js.map +1 -0
- package/skinny/rich-table/index.d.ts +21 -0
- package/skinny/rich-table/index.esm.js +586 -0
- package/skinny/rich-table/index.esm.js.map +1 -0
- package/skinny/utils-65c486f0.cjs.js +139 -0
- package/skinny/utils-65c486f0.cjs.js.map +1 -0
- package/skinny/utils-c32bd7ed.esm.js +118 -0
- package/skinny/utils-c32bd7ed.esm.js.map +1 -0
- package/skinny/utils.d.ts +72 -0
- package/skinny/widgets.d.ts +2 -0
package/package.json
CHANGED
|
@@ -1,13 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/plasmic-rich-components",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.170",
|
|
4
4
|
"description": "Rich batteries-included general purpose components for business apps, admin panels, etc.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"module": "dist/plasmic-rich-components.esm.js",
|
|
8
8
|
"files": [
|
|
9
|
-
"dist"
|
|
9
|
+
"dist",
|
|
10
|
+
"skinny"
|
|
10
11
|
],
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"require": "./dist/index.js",
|
|
15
|
+
"import": "./dist/plasmic-rich-components.esm.js",
|
|
16
|
+
"types": "./dist/index.d.ts"
|
|
17
|
+
},
|
|
18
|
+
"./skinny/*": {
|
|
19
|
+
"require": "./skinny/*/index.cjs.js",
|
|
20
|
+
"import": "./skinny/*/index.esm.js",
|
|
21
|
+
"types": "./skinny/*/index.d.ts"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
11
24
|
"size-limit": [
|
|
12
25
|
{
|
|
13
26
|
"path": "dist/plasmic-rich-components.cjs.production.min.js",
|
|
@@ -19,7 +32,7 @@
|
|
|
19
32
|
}
|
|
20
33
|
],
|
|
21
34
|
"scripts": {
|
|
22
|
-
"build": "rollup -c rollup.config.mjs && yarn tsc --emitDeclarationOnly --declaration src/index.tsx --incremental --tsBuildInfoFile ./dist/.tsbuildinfo --skipLibCheck --jsx react --lib dom,esnext --esModuleInterop --strict --outDir ./dist/",
|
|
35
|
+
"build": "rollup -c rollup.config.mjs && yarn tsc --emitDeclarationOnly --declaration src/index.tsx --incremental --tsBuildInfoFile ./dist/.tsbuildinfo --skipLibCheck --jsx react --lib dom,esnext --esModuleInterop --strict --outDir ./dist/ && rsync -r --include='*/' --include='*.d.ts' --exclude='*' ./dist/ ./skinny/ && rm skinny/index.d.ts",
|
|
23
36
|
"test": "yarn --cwd=../.. test --passWithNoTests",
|
|
24
37
|
"prepublishOnly": "npm run build",
|
|
25
38
|
"size": "size-limit",
|
|
@@ -41,6 +54,7 @@
|
|
|
41
54
|
"@types/node": "^20.8.9",
|
|
42
55
|
"@types/react": "^18.2.33",
|
|
43
56
|
"antd": "^5.4.0",
|
|
57
|
+
"glob": "^8.1.0",
|
|
44
58
|
"rollup": "^3.26.2",
|
|
45
59
|
"rollup-plugin-esbuild": "^5.0.0",
|
|
46
60
|
"size-limit": "^4.11.0",
|
|
@@ -68,5 +82,5 @@
|
|
|
68
82
|
"fast-stringify": "^2.0.0",
|
|
69
83
|
"lodash": "^4.17.21"
|
|
70
84
|
},
|
|
71
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "8f013c9e895ee9aebc0224e43b45b82a30771e9f"
|
|
72
86
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { tinycolor } from '@ctrl/tinycolor';
|
|
3
|
+
|
|
4
|
+
function useIsClient() {
|
|
5
|
+
const [loaded, setLoaded] = React.useState(false);
|
|
6
|
+
useIsomorphicLayoutEffect(() => {
|
|
7
|
+
setLoaded(true);
|
|
8
|
+
});
|
|
9
|
+
return loaded;
|
|
10
|
+
}
|
|
11
|
+
const isBrowser = typeof window !== "undefined";
|
|
12
|
+
const useIsomorphicLayoutEffect = isBrowser ? React.useLayoutEffect : React.useEffect;
|
|
13
|
+
function capitalize(text) {
|
|
14
|
+
return text.slice(0, 1).toUpperCase() + text.slice(1);
|
|
15
|
+
}
|
|
16
|
+
function isLight(color) {
|
|
17
|
+
const { r, g, b } = tinycolor(color).toRgb();
|
|
18
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export { capitalize as c, isLight as i, useIsClient as u };
|
|
22
|
+
//# sourceMappingURL=common-8cca2977.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-8cca2977.esm.js","sources":["../src/common.ts"],"sourcesContent":["import React from \"react\";\nimport { tinycolor } from \"@ctrl/tinycolor\";\n\nexport function useIsClient() {\n const [loaded, setLoaded] = React.useState(false);\n useIsomorphicLayoutEffect(() => {\n setLoaded(true);\n });\n return loaded;\n}\n\nconst isBrowser = typeof window !== \"undefined\";\nexport const useIsomorphicLayoutEffect = isBrowser\n ? React.useLayoutEffect\n : React.useEffect;\n\nexport function capitalize(text: string) {\n return text.slice(0, 1).toUpperCase() + text.slice(1);\n}\n\nexport function isLight(color: string) {\n const { r, g, b } = tinycolor(color).toRgb();\n return r * 0.299 + g * 0.587 + b * 0.114 > 186;\n}\n"],"names":[],"mappings":";;;AAGO,SAAS,WAAc,GAAA;AAC5B,EAAA,MAAM,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAA,KAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AAChD,EAAA,yBAAA,CAA0B,MAAM;AAC9B,IAAA,SAAA,CAAU,IAAI,CAAA,CAAA;AAAA,GACf,CAAA,CAAA;AACD,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAEA,MAAM,SAAA,GAAY,OAAO,MAAW,KAAA,WAAA,CAAA;AAC7B,MAAM,yBAA4B,GAAA,SAAA,GACrC,KAAM,CAAA,eAAA,GACN,KAAM,CAAA,SAAA,CAAA;AAEH,SAAS,WAAW,IAAc,EAAA;AACvC,EAAO,OAAA,IAAA,CAAK,MAAM,CAAG,EAAA,CAAC,EAAE,WAAY,EAAA,GAAI,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA,CAAA;AACtD,CAAA;AAEO,SAAS,QAAQ,KAAe,EAAA;AACrC,EAAM,MAAA,EAAE,GAAG,CAAG,EAAA,CAAA,KAAM,SAAU,CAAA,KAAK,EAAE,KAAM,EAAA,CAAA;AAC3C,EAAA,OAAO,CAAI,GAAA,KAAA,GAAQ,CAAI,GAAA,KAAA,GAAQ,IAAI,KAAQ,GAAA,GAAA,CAAA;AAC7C;;;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var tinycolor = require('@ctrl/tinycolor');
|
|
5
|
+
|
|
6
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
|
+
|
|
8
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
9
|
+
|
|
10
|
+
function useIsClient() {
|
|
11
|
+
const [loaded, setLoaded] = React__default.default.useState(false);
|
|
12
|
+
useIsomorphicLayoutEffect(() => {
|
|
13
|
+
setLoaded(true);
|
|
14
|
+
});
|
|
15
|
+
return loaded;
|
|
16
|
+
}
|
|
17
|
+
const isBrowser = typeof window !== "undefined";
|
|
18
|
+
const useIsomorphicLayoutEffect = isBrowser ? React__default.default.useLayoutEffect : React__default.default.useEffect;
|
|
19
|
+
function capitalize(text) {
|
|
20
|
+
return text.slice(0, 1).toUpperCase() + text.slice(1);
|
|
21
|
+
}
|
|
22
|
+
function isLight(color) {
|
|
23
|
+
const { r, g, b } = tinycolor.tinycolor(color).toRgb();
|
|
24
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.capitalize = capitalize;
|
|
28
|
+
exports.isLight = isLight;
|
|
29
|
+
exports.useIsClient = useIsClient;
|
|
30
|
+
//# sourceMappingURL=common-e1d76791.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-e1d76791.cjs.js","sources":["../src/common.ts"],"sourcesContent":["import React from \"react\";\nimport { tinycolor } from \"@ctrl/tinycolor\";\n\nexport function useIsClient() {\n const [loaded, setLoaded] = React.useState(false);\n useIsomorphicLayoutEffect(() => {\n setLoaded(true);\n });\n return loaded;\n}\n\nconst isBrowser = typeof window !== \"undefined\";\nexport const useIsomorphicLayoutEffect = isBrowser\n ? React.useLayoutEffect\n : React.useEffect;\n\nexport function capitalize(text: string) {\n return text.slice(0, 1).toUpperCase() + text.slice(1);\n}\n\nexport function isLight(color: string) {\n const { r, g, b } = tinycolor(color).toRgb();\n return r * 0.299 + g * 0.587 + b * 0.114 > 186;\n}\n"],"names":["React","tinycolor"],"mappings":";;;;;;;;;AAGO,SAAS,WAAc,GAAA;AAC5B,EAAA,MAAM,CAAC,MAAQ,EAAA,SAAS,CAAI,GAAAA,sBAAA,CAAM,SAAS,KAAK,CAAA,CAAA;AAChD,EAAA,yBAAA,CAA0B,MAAM;AAC9B,IAAA,SAAA,CAAU,IAAI,CAAA,CAAA;AAAA,GACf,CAAA,CAAA;AACD,EAAO,OAAA,MAAA,CAAA;AACT,CAAA;AAEA,MAAM,SAAA,GAAY,OAAO,MAAW,KAAA,WAAA,CAAA;AAC7B,MAAM,yBAA4B,GAAA,SAAA,GACrCA,sBAAM,CAAA,eAAA,GACNA,sBAAM,CAAA,SAAA,CAAA;AAEH,SAAS,WAAW,IAAc,EAAA;AACvC,EAAO,OAAA,IAAA,CAAK,MAAM,CAAG,EAAA,CAAC,EAAE,WAAY,EAAA,GAAI,IAAK,CAAA,KAAA,CAAM,CAAC,CAAA,CAAA;AACtD,CAAA;AAEO,SAAS,QAAQ,KAAe,EAAA;AACrC,EAAM,MAAA,EAAE,GAAG,CAAG,EAAA,CAAA,KAAMC,mBAAU,CAAA,KAAK,EAAE,KAAM,EAAA,CAAA;AAC3C,EAAA,OAAO,CAAI,GAAA,KAAA,GAAQ,CAAI,GAAA,KAAA,GAAQ,IAAI,KAAQ,GAAA,GAAA,CAAA;AAC7C;;;;;;"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var formatting = require('./formatting-327e0658.cjs.js');
|
|
4
|
+
var common = require('./common-e1d76791.cjs.js');
|
|
5
|
+
var utils = require('./utils-65c486f0.cjs.js');
|
|
6
|
+
|
|
7
|
+
function roleProp({
|
|
8
|
+
role,
|
|
9
|
+
singular = false,
|
|
10
|
+
advanced = false,
|
|
11
|
+
displayName
|
|
12
|
+
}) {
|
|
13
|
+
return singular ? {
|
|
14
|
+
type: "object",
|
|
15
|
+
displayName: displayName || `${common.capitalize(role)} field`,
|
|
16
|
+
advanced,
|
|
17
|
+
hidden: (ps) => !ps.data,
|
|
18
|
+
nameFunc: (item) => utils.maybe(
|
|
19
|
+
item,
|
|
20
|
+
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
21
|
+
),
|
|
22
|
+
fields: formatting.getFieldSubprops({
|
|
23
|
+
canChangeField: true,
|
|
24
|
+
noTitle: true
|
|
25
|
+
}),
|
|
26
|
+
defaultValueHint: (_props, contextData) => {
|
|
27
|
+
var _a;
|
|
28
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
29
|
+
(f) => f.role === role
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
} : formatting.buildFieldsPropType({
|
|
33
|
+
displayName: displayName || `${common.capitalize(role)} fields`,
|
|
34
|
+
advanced,
|
|
35
|
+
noTitle: true,
|
|
36
|
+
canChangeField: true,
|
|
37
|
+
minimalValue: (_props, contextData) => {
|
|
38
|
+
var _a;
|
|
39
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
40
|
+
(f) => f.role === role
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function dataProp() {
|
|
46
|
+
return {
|
|
47
|
+
type: "dataSourceOpData",
|
|
48
|
+
description: "The data to display"
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function commonProps() {
|
|
52
|
+
return {
|
|
53
|
+
pagination: {
|
|
54
|
+
type: "boolean",
|
|
55
|
+
advanced: true,
|
|
56
|
+
defaultValueHint: true
|
|
57
|
+
},
|
|
58
|
+
pageSize: {
|
|
59
|
+
type: "number",
|
|
60
|
+
defaultValueHint: 10,
|
|
61
|
+
advanced: true
|
|
62
|
+
},
|
|
63
|
+
hideSearch: {
|
|
64
|
+
type: "boolean",
|
|
65
|
+
description: "Hides the search toolbar",
|
|
66
|
+
advanced: true
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function rowActionsProp() {
|
|
71
|
+
return {
|
|
72
|
+
type: "array",
|
|
73
|
+
displayName: "Row actions",
|
|
74
|
+
advanced: true,
|
|
75
|
+
itemType: {
|
|
76
|
+
type: "object",
|
|
77
|
+
nameFunc: (item) => item.label,
|
|
78
|
+
fields: {
|
|
79
|
+
type: {
|
|
80
|
+
type: "choice",
|
|
81
|
+
options: ["item", "menu"],
|
|
82
|
+
defaultValue: "item"
|
|
83
|
+
},
|
|
84
|
+
label: {
|
|
85
|
+
type: "string",
|
|
86
|
+
displayName: "Action label"
|
|
87
|
+
},
|
|
88
|
+
children: {
|
|
89
|
+
type: "array",
|
|
90
|
+
displayName: "Menu items",
|
|
91
|
+
itemType: {
|
|
92
|
+
type: "object",
|
|
93
|
+
fields: {
|
|
94
|
+
label: {
|
|
95
|
+
type: "string",
|
|
96
|
+
displayName: "Action label"
|
|
97
|
+
},
|
|
98
|
+
onClick: {
|
|
99
|
+
type: "eventHandler",
|
|
100
|
+
argTypes: [
|
|
101
|
+
{ name: "rowKey", type: "string" },
|
|
102
|
+
{ name: "row", type: "object" }
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
108
|
+
},
|
|
109
|
+
onClick: {
|
|
110
|
+
type: "eventHandler",
|
|
111
|
+
displayName: "Action",
|
|
112
|
+
argTypes: [
|
|
113
|
+
{ name: "rowKey", type: "string" },
|
|
114
|
+
{ name: "row", type: "object" }
|
|
115
|
+
],
|
|
116
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
function onRowClickProp() {
|
|
123
|
+
return {
|
|
124
|
+
type: "eventHandler",
|
|
125
|
+
displayName: "On row clicked",
|
|
126
|
+
argTypes: [
|
|
127
|
+
{ name: "rowKey", type: "string" },
|
|
128
|
+
{ name: "row", type: "object" },
|
|
129
|
+
{ name: "event", type: "object" }
|
|
130
|
+
]
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
exports.commonProps = commonProps;
|
|
135
|
+
exports.dataProp = dataProp;
|
|
136
|
+
exports.onRowClickProp = onRowClickProp;
|
|
137
|
+
exports.roleProp = roleProp;
|
|
138
|
+
exports.rowActionsProp = rowActionsProp;
|
|
139
|
+
//# sourceMappingURL=common-prop-types-5f1fd4b0.cjs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-prop-types-5f1fd4b0.cjs.js","sources":["../src/common-prop-types.tsx"],"sourcesContent":["import { PropType } from \"@plasmicapp/host/registerComponent\";\nimport {\n BaseColumnConfig,\n FieldfulProps,\n buildFieldsPropType,\n getFieldSubprops,\n} from \"./field-mappings\";\nimport { capitalize } from \"./common\";\nimport { maybe } from \"./utils\";\n\nexport function roleProp<P extends FieldfulProps<any>>({\n role,\n singular = false,\n advanced = false,\n displayName,\n}: {\n role: string;\n singular?: boolean;\n advanced?: boolean;\n displayName?: string;\n}): PropType<P> {\n return singular\n ? {\n type: \"object\",\n displayName: displayName || `${capitalize(role)} field`,\n advanced,\n hidden: (ps) => !ps.data,\n nameFunc: (item) =>\n maybe(item, (i) =>\n i.isHidden ? \"Hidden\" : i.fieldId || \"Custom value\"\n ),\n fields: getFieldSubprops({\n canChangeField: true,\n noTitle: true,\n }),\n defaultValueHint: (_props, contextData) =>\n (contextData?.minimalFullLengthFields ?? []).find(\n (f) => f.role === role\n ),\n }\n : buildFieldsPropType<BaseColumnConfig, P>({\n displayName: displayName || `${capitalize(role)} fields`,\n advanced,\n noTitle: true,\n canChangeField: true,\n minimalValue: (_props, contextData) =>\n (contextData?.minimalFullLengthFields ?? []).filter(\n (f) => f.role === role\n ),\n });\n}\n\nexport function dataProp<T>(): PropType<T> {\n return {\n type: \"dataSourceOpData\" as any,\n description: \"The data to display\",\n };\n}\n\nexport function commonProps<T>(): Record<string, PropType<T>> {\n return {\n pagination: {\n type: \"boolean\",\n advanced: true,\n defaultValueHint: true,\n },\n\n pageSize: {\n type: \"number\",\n defaultValueHint: 10,\n advanced: true,\n },\n\n hideSearch: {\n type: \"boolean\",\n description: \"Hides the search toolbar\",\n advanced: true,\n },\n };\n}\n\nexport function rowActionsProp<T>(): PropType<T> {\n return {\n type: \"array\",\n displayName: \"Row actions\",\n advanced: true,\n itemType: {\n type: \"object\",\n nameFunc: (item) => item.label,\n fields: {\n type: {\n type: \"choice\",\n options: [\"item\", \"menu\"],\n defaultValue: \"item\",\n },\n label: {\n type: \"string\",\n displayName: \"Action label\",\n },\n children: {\n type: \"array\",\n displayName: \"Menu items\",\n itemType: {\n type: \"object\",\n fields: {\n label: {\n type: \"string\",\n displayName: \"Action label\",\n },\n onClick: {\n type: \"eventHandler\",\n argTypes: [\n { name: \"rowKey\", type: \"string\" },\n { name: \"row\", type: \"object\" },\n ],\n },\n },\n },\n hidden: (_ps, _ctx, { item }) => item.type !== \"menu\",\n },\n onClick: {\n type: \"eventHandler\",\n displayName: \"Action\",\n argTypes: [\n { name: \"rowKey\", type: \"string\" },\n { name: \"row\", type: \"object\" },\n ],\n hidden: (_ps, _ctx, { item }) => item.type !== \"item\",\n },\n },\n },\n };\n}\n\nexport function onRowClickProp<T>(): PropType<T> {\n return {\n type: \"eventHandler\",\n displayName: \"On row clicked\",\n argTypes: [\n { name: \"rowKey\", type: \"string\" },\n { name: \"row\", type: \"object\" },\n { name: \"event\", type: \"object\" },\n ],\n };\n}\n"],"names":["capitalize","maybe","getFieldSubprops","buildFieldsPropType"],"mappings":";;;;;;AAUO,SAAS,QAAuC,CAAA;AAAA,EACrD,IAAA;AAAA,EACA,QAAW,GAAA,KAAA;AAAA,EACX,QAAW,GAAA,KAAA;AAAA,EACX,WAAA;AACF,CAKgB,EAAA;AACd,EAAA,OAAO,QACH,GAAA;AAAA,IACE,IAAM,EAAA,QAAA;AAAA,IACN,WAAa,EAAA,WAAA,IAAe,CAAG,EAAAA,iBAAA,CAAW,IAAI,CAAA,CAAA,MAAA,CAAA;AAAA,IAC9C,QAAA;AAAA,IACA,MAAQ,EAAA,CAAC,EAAO,KAAA,CAAC,EAAG,CAAA,IAAA;AAAA,IACpB,QAAA,EAAU,C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ildFieldsPropType } from './formatting-aff39488.esm.js';
|
|
2
|
+
import { c as capitalize } from './common-8cca2977.esm.js';
|
|
3
|
+
import { m as maybe } from './utils-c32bd7ed.esm.js';
|
|
4
|
+
|
|
5
|
+
function roleProp({
|
|
6
|
+
role,
|
|
7
|
+
singular = false,
|
|
8
|
+
advanced = false,
|
|
9
|
+
displayName
|
|
10
|
+
}) {
|
|
11
|
+
return singular ? {
|
|
12
|
+
type: "object",
|
|
13
|
+
displayName: displayName || `${capitalize(role)} field`,
|
|
14
|
+
advanced,
|
|
15
|
+
hidden: (ps) => !ps.data,
|
|
16
|
+
nameFunc: (item) => maybe(
|
|
17
|
+
item,
|
|
18
|
+
(i) => i.isHidden ? "Hidden" : i.fieldId || "Custom value"
|
|
19
|
+
),
|
|
20
|
+
fields: getFieldSubprops({
|
|
21
|
+
canChangeField: true,
|
|
22
|
+
noTitle: true
|
|
23
|
+
}),
|
|
24
|
+
defaultValueHint: (_props, contextData) => {
|
|
25
|
+
var _a;
|
|
26
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).find(
|
|
27
|
+
(f) => f.role === role
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
} : buildFieldsPropType({
|
|
31
|
+
displayName: displayName || `${capitalize(role)} fields`,
|
|
32
|
+
advanced,
|
|
33
|
+
noTitle: true,
|
|
34
|
+
canChangeField: true,
|
|
35
|
+
minimalValue: (_props, contextData) => {
|
|
36
|
+
var _a;
|
|
37
|
+
return ((_a = contextData == null ? void 0 : contextData.minimalFullLengthFields) != null ? _a : []).filter(
|
|
38
|
+
(f) => f.role === role
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
function dataProp() {
|
|
44
|
+
return {
|
|
45
|
+
type: "dataSourceOpData",
|
|
46
|
+
description: "The data to display"
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
function commonProps() {
|
|
50
|
+
return {
|
|
51
|
+
pagination: {
|
|
52
|
+
type: "boolean",
|
|
53
|
+
advanced: true,
|
|
54
|
+
defaultValueHint: true
|
|
55
|
+
},
|
|
56
|
+
pageSize: {
|
|
57
|
+
type: "number",
|
|
58
|
+
defaultValueHint: 10,
|
|
59
|
+
advanced: true
|
|
60
|
+
},
|
|
61
|
+
hideSearch: {
|
|
62
|
+
type: "boolean",
|
|
63
|
+
description: "Hides the search toolbar",
|
|
64
|
+
advanced: true
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function rowActionsProp() {
|
|
69
|
+
return {
|
|
70
|
+
type: "array",
|
|
71
|
+
displayName: "Row actions",
|
|
72
|
+
advanced: true,
|
|
73
|
+
itemType: {
|
|
74
|
+
type: "object",
|
|
75
|
+
nameFunc: (item) => item.label,
|
|
76
|
+
fields: {
|
|
77
|
+
type: {
|
|
78
|
+
type: "choice",
|
|
79
|
+
options: ["item", "menu"],
|
|
80
|
+
defaultValue: "item"
|
|
81
|
+
},
|
|
82
|
+
label: {
|
|
83
|
+
type: "string",
|
|
84
|
+
displayName: "Action label"
|
|
85
|
+
},
|
|
86
|
+
children: {
|
|
87
|
+
type: "array",
|
|
88
|
+
displayName: "Menu items",
|
|
89
|
+
itemType: {
|
|
90
|
+
type: "object",
|
|
91
|
+
fields: {
|
|
92
|
+
label: {
|
|
93
|
+
type: "string",
|
|
94
|
+
displayName: "Action label"
|
|
95
|
+
},
|
|
96
|
+
onClick: {
|
|
97
|
+
type: "eventHandler",
|
|
98
|
+
argTypes: [
|
|
99
|
+
{ name: "rowKey", type: "string" },
|
|
100
|
+
{ name: "row", type: "object" }
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "menu"
|
|
106
|
+
},
|
|
107
|
+
onClick: {
|
|
108
|
+
type: "eventHandler",
|
|
109
|
+
displayName: "Action",
|
|
110
|
+
argTypes: [
|
|
111
|
+
{ name: "rowKey", type: "string" },
|
|
112
|
+
{ name: "row", type: "object" }
|
|
113
|
+
],
|
|
114
|
+
hidden: (_ps, _ctx, { item }) => item.type !== "item"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function onRowClickProp() {
|
|
121
|
+
return {
|
|
122
|
+
type: "eventHandler",
|
|
123
|
+
displayName: "On row clicked",
|
|
124
|
+
argTypes: [
|
|
125
|
+
{ name: "rowKey", type: "string" },
|
|
126
|
+
{ name: "row", type: "object" },
|
|
127
|
+
{ name: "event", type: "object" }
|
|
128
|
+
]
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export { rowActionsProp as a, commonProps as c, dataProp as d, onRowClickProp as o, roleProp as r };
|
|
133
|
+
//# sourceMappingURL=common-prop-types-686c49fe.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common-prop-types-686c49fe.esm.js","sources":["../src/common-prop-types.tsx"],"sourcesContent":["import { PropType } from \"@plasmicapp/host/registerComponent\";\nimport {\n BaseColumnConfig,\n FieldfulProps,\n buildFieldsPropType,\n getFieldSubprops,\n} from \"./field-mappings\";\nimport { capitalize } from \"./common\";\nimport { maybe } from \"./utils\";\n\nexport function roleProp<P extends FieldfulProps<any>>({\n role,\n singular = false,\n advanced = false,\n displayName,\n}: {\n role: string;\n singular?: boolean;\n advanced?: boolean;\n displayName?: string;\n}): PropType<P> {\n return singular\n ? {\n type: \"object\",\n displayName: displayName || `${capitalize(role)} field`,\n advanced,\n hidden: (ps) => !ps.data,\n nameFunc: (item) =>\n maybe(item, (i) =>\n i.isHidden ? \"Hidden\" : i.fieldId || \"Custom value\"\n ),\n fields: getFieldSubprops({\n canChangeField: true,\n noTitle: true,\n }),\n defaultValueHint: (_props, contextData) =>\n (contextData?.minimalFullLengthFields ?? []).find(\n (f) => f.role === role\n ),\n }\n : buildFieldsPropType<BaseColumnConfig, P>({\n displayName: displayName || `${capitalize(role)} fields`,\n advanced,\n noTitle: true,\n canChangeField: true,\n minimalValue: (_props, contextData) =>\n (contextData?.minimalFullLengthFields ?? []).filter(\n (f) => f.role === role\n ),\n });\n}\n\nexport function dataProp<T>(): PropType<T> {\n return {\n type: \"dataSourceOpData\" as any,\n description: \"The data to display\",\n };\n}\n\nexport function commonProps<T>(): Record<string, PropType<T>> {\n return {\n pagination: {\n type: \"boolean\",\n advanced: true,\n defaultValueHint: true,\n },\n\n pageSize: {\n type: \"number\",\n defaultValueHint: 10,\n advanced: true,\n },\n\n hideSearch: {\n type: \"boolean\",\n description: \"Hides the search toolbar\",\n advanced: true,\n },\n };\n}\n\nexport function rowActionsProp<T>(): PropType<T> {\n return {\n type: \"array\",\n displayName: \"Row actions\",\n advanced: true,\n itemType: {\n type: \"object\",\n nameFunc: (item) => item.label,\n fields: {\n type: {\n type: \"choice\",\n options: [\"item\", \"menu\"],\n defaultValue: \"item\",\n },\n label: {\n type: \"string\",\n displayName: \"Action label\",\n },\n children: {\n type: \"array\",\n displayName: \"Menu items\",\n itemType: {\n type: \"object\",\n fields: {\n label: {\n type: \"string\",\n displayName: \"Action label\",\n },\n onClick: {\n type: \"eventHandler\",\n argTypes: [\n { name: \"rowKey\", type: \"string\" },\n { name: \"row\", type: \"object\" },\n ],\n },\n },\n },\n hidden: (_ps, _ctx, { item }) => item.type !== \"menu\",\n },\n onClick: {\n type: \"eventHandler\",\n displayName: \"Action\",\n argTypes: [\n { name: \"rowKey\", type: \"string\" },\n { name: \"row\", type: \"object\" },\n ],\n hidden: (_ps, _ctx, { item }) => item.type !== \"item\",\n },\n },\n },\n };\n}\n\nexport function onRowClickProp<T>(): PropType<T> {\n return {\n type: \"eventHandler\",\n displayName: \"On row clicked\",\n argTypes: [\n { name: \"rowKey\", type: \"string\" },\n { name: \"row\", type: \"object\" },\n { name: \"event\", type: \"object\" },\n ],\n };\n}\n"],"names":[],"mappings":";;;;AAUO,SAAS,QAAuC,CAA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AAA,cAAA;AAAA,IACN,WAAa,EAAA,gBAAA;AAAA,IACb,QAAU,EAAA;AAAA,MACR,EAAE,IAAA,EAAM,QAAU,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,MACjC,EAAE,IAAA,EAAM,KAAO,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,MAC9B,EAAE,IAAA,EAAM,OAAS,EAAA,IAAA,EAAM,QAAS,EAAA;AAAA,KAClC;AAAA,GACF,CAAA;AACF;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { PropType } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import { FieldfulProps } from "./field-mappings";
|
|
3
|
+
export declare function roleProp<P extends FieldfulProps<any>>({ role, singular, advanced, displayName, }: {
|
|
4
|
+
role: string;
|
|
5
|
+
singular?: boolean;
|
|
6
|
+
advanced?: boolean;
|
|
7
|
+
displayName?: string;
|
|
8
|
+
}): PropType<P>;
|
|
9
|
+
export declare function dataProp<T>(): PropType<T>;
|
|
10
|
+
export declare function commonProps<T>(): Record<string, PropType<T>>;
|
|
11
|
+
export declare function rowActionsProp<T>(): PropType<T>;
|
|
12
|
+
export declare function onRowClickProp<T>(): PropType<T>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export declare function useIsClient(): boolean;
|
|
3
|
+
export declare const useIsomorphicLayoutEffect: typeof React.useLayoutEffect;
|
|
4
|
+
export declare function capitalize(text: string): string;
|
|
5
|
+
export declare function isLight(color: string): boolean;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { TableSchema, QueryResult } from "@plasmicapp/data-sources";
|
|
2
|
+
import { PropType } from "@plasmicapp/host/registerComponent";
|
|
3
|
+
import { ContextDependentConfig } from "@plasmicapp/host";
|
|
4
|
+
export interface AutoSettings {
|
|
5
|
+
dataType: "auto";
|
|
6
|
+
}
|
|
7
|
+
interface _SharedNumberSettings {
|
|
8
|
+
notation?: "standard" | "scientific" | "engineering" | "compact";
|
|
9
|
+
signDisplay?: "auto" | "always" | "exceptZero";
|
|
10
|
+
maximumFractionDigits?: number;
|
|
11
|
+
minimumFractionDigits?: number;
|
|
12
|
+
locale?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DecimalSettings extends _SharedNumberSettings {
|
|
15
|
+
dataType: "number";
|
|
16
|
+
}
|
|
17
|
+
export interface PercentSettings extends _SharedNumberSettings {
|
|
18
|
+
dataType: "percent";
|
|
19
|
+
}
|
|
20
|
+
export interface CurrencySettings extends _SharedNumberSettings {
|
|
21
|
+
dataType: "currency";
|
|
22
|
+
currency?: string;
|
|
23
|
+
currencyDisplay?: "symbol" | "narrowSymbol" | "code" | "name";
|
|
24
|
+
}
|
|
25
|
+
export declare const DEFAULT_CURRENCY_SETTINGS: CurrencySettings;
|
|
26
|
+
export type NumberSettings = DecimalSettings | PercentSettings | CurrencySettings;
|
|
27
|
+
export declare const NUMBER_TYPES: readonly ["number", "percent", "currency"];
|
|
28
|
+
export interface DateTimeSettings {
|
|
29
|
+
dataType: "datetime";
|
|
30
|
+
locale?: string;
|
|
31
|
+
dateStyle?: "none" | "full" | "long" | "medium" | "short";
|
|
32
|
+
timeStyle?: "none" | "full" | "long" | "medium" | "short";
|
|
33
|
+
hour12?: boolean;
|
|
34
|
+
timeZone?: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const DEFAULT_DATETIME_SETTINGS: DateTimeSettings;
|
|
37
|
+
export interface RelativeDateTimeSettings {
|
|
38
|
+
dataType: "relative-datetime";
|
|
39
|
+
locale?: string;
|
|
40
|
+
numeric?: "always" | "auto";
|
|
41
|
+
style?: "long" | "short" | "narrow";
|
|
42
|
+
unit?: "year" | "month" | "week" | "day" | "hour" | "minute" | "second";
|
|
43
|
+
}
|
|
44
|
+
export declare const DEFAULT_RELATIVE_DATETIME_SETTINGS: RelativeDateTimeSettings;
|
|
45
|
+
export declare const DATETIME_TYPES: readonly ["datetime", "relative-datetime"];
|
|
46
|
+
export interface BooleanSettings {
|
|
47
|
+
dataType: "boolean";
|
|
48
|
+
showAs?: "text" | "checkbox" | "switch";
|
|
49
|
+
}
|
|
50
|
+
export declare const DEFAULT_BOOLEAN_SETTINGS: BooleanSettings;
|
|
51
|
+
export interface StringSettings {
|
|
52
|
+
dataType: "string";
|
|
53
|
+
}
|
|
54
|
+
export type RowFunc<Result> = (row: Record<string, unknown>) => Result;
|
|
55
|
+
export type CellFunc<Result> = (row: Record<string, unknown>, value: unknown) => Result;
|
|
56
|
+
/**
|
|
57
|
+
* Exprs are for things that can must re-evaluate from row to row.
|
|
58
|
+
*
|
|
59
|
+
* Literal values are for things that are column-level. (But in Plasmic Studio, as with all props, you can still use a dynamic value.)
|
|
60
|
+
*/
|
|
61
|
+
interface _BaseColumnConfig {
|
|
62
|
+
key: string;
|
|
63
|
+
fieldId?: string;
|
|
64
|
+
title?: string;
|
|
65
|
+
isHidden: boolean;
|
|
66
|
+
expr?: CellFunc<any>;
|
|
67
|
+
}
|
|
68
|
+
export type BaseColumnConfig = _BaseColumnConfig & (AutoSettings | NumberSettings | StringSettings | BooleanSettings | DateTimeSettings | RelativeDateTimeSettings);
|
|
69
|
+
export declare function deriveValueType(cconfig: BaseColumnConfig): "text" | "switch" | "digit" | undefined;
|
|
70
|
+
export interface ControlContextData<ColumnConfig extends BaseColumnConfig> {
|
|
71
|
+
data: unknown[];
|
|
72
|
+
schema?: TableSchema;
|
|
73
|
+
mergedFields: ColumnConfig[];
|
|
74
|
+
minimalFullLengthFields: Partial<ColumnConfig>[];
|
|
75
|
+
}
|
|
76
|
+
export interface FieldfulProps<ColumnConfig extends BaseColumnConfig> {
|
|
77
|
+
className?: string;
|
|
78
|
+
data?: QueryResult;
|
|
79
|
+
fields?: Partial<ColumnConfig>[];
|
|
80
|
+
setControlContextData?: (ctx: ControlContextData<ColumnConfig>) => void;
|
|
81
|
+
}
|
|
82
|
+
export declare const NoneField = "||NoneField||";
|
|
83
|
+
export declare const CustomField = "";
|
|
84
|
+
interface FieldSubpropsOpts<ColumnConfig extends BaseColumnConfig> {
|
|
85
|
+
fieldTypes?: Record<string, PropType<any>>;
|
|
86
|
+
canChangeField?: boolean;
|
|
87
|
+
canPickNoneField?: boolean;
|
|
88
|
+
noTitle?: boolean;
|
|
89
|
+
noDataType?: boolean;
|
|
90
|
+
hiddenFieldId?: (ps: Record<string, unknown>, ctx: ControlContextData<ColumnConfig>, extras: {
|
|
91
|
+
path: (string | number)[];
|
|
92
|
+
}) => boolean;
|
|
93
|
+
}
|
|
94
|
+
export declare function getFieldSubprops<ColumnConfig extends BaseColumnConfig>(opts: FieldSubpropsOpts<ColumnConfig>): Record<string, PropType<any>>;
|
|
95
|
+
export declare function buildFieldsPropType<ColumnConfig extends BaseColumnConfig, Props extends FieldfulProps<ColumnConfig>>({ advanced, displayName, minimalValue, ...opts }: {
|
|
96
|
+
advanced?: boolean;
|
|
97
|
+
displayName?: string;
|
|
98
|
+
minimalValue?: ContextDependentConfig<Props, any>;
|
|
99
|
+
} & FieldSubpropsOpts<ColumnConfig>): PropType<Props>;
|
|
100
|
+
export {};
|