@pdfme/schemas 3.1.5-dev.6 → 3.1.5-dev.7
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/cjs/src/barcodes/propPanel.js +27 -29
- package/dist/cjs/src/barcodes/propPanel.js.map +1 -1
- package/dist/cjs/src/barcodes/uiRender.js +3 -5
- package/dist/cjs/src/barcodes/uiRender.js.map +1 -1
- package/dist/cjs/src/image/pdfRender.js +2 -0
- package/dist/cjs/src/image/pdfRender.js.map +1 -1
- package/dist/cjs/src/image/uiRender.js +3 -2
- package/dist/cjs/src/image/uiRender.js.map +1 -1
- package/dist/cjs/src/index.js +3 -1
- package/dist/cjs/src/index.js.map +1 -1
- package/dist/cjs/src/line/constants.js +5 -0
- package/dist/cjs/src/line/constants.js.map +1 -0
- package/dist/cjs/src/line/index.js +8 -0
- package/dist/cjs/src/line/index.js.map +1 -0
- package/dist/cjs/src/line/pdfRender.js +20 -0
- package/dist/cjs/src/line/pdfRender.js.map +1 -0
- package/dist/cjs/src/line/propPanel.js +35 -0
- package/dist/cjs/src/line/propPanel.js.map +1 -0
- package/dist/cjs/src/line/types.js +3 -0
- package/dist/cjs/src/line/types.js.map +1 -0
- package/dist/cjs/src/line/uiRender.js +17 -0
- package/dist/cjs/src/line/uiRender.js.map +1 -0
- package/dist/cjs/src/renderUtils.js +28 -1
- package/dist/cjs/src/renderUtils.js.map +1 -1
- package/dist/cjs/src/text/index.js.map +1 -1
- package/dist/cjs/src/text/pdfRender.js +5 -28
- package/dist/cjs/src/text/pdfRender.js.map +1 -1
- package/dist/cjs/src/text/propPanel.js +2 -2
- package/dist/cjs/src/text/propPanel.js.map +1 -1
- package/dist/cjs/src/text/uiRender.js +11 -15
- package/dist/cjs/src/text/uiRender.js.map +1 -1
- package/dist/esm/src/barcodes/propPanel.js +27 -29
- package/dist/esm/src/barcodes/propPanel.js.map +1 -1
- package/dist/esm/src/barcodes/uiRender.js +4 -6
- package/dist/esm/src/barcodes/uiRender.js.map +1 -1
- package/dist/esm/src/image/pdfRender.js +2 -0
- package/dist/esm/src/image/pdfRender.js.map +1 -1
- package/dist/esm/src/image/uiRender.js +4 -3
- package/dist/esm/src/image/uiRender.js.map +1 -1
- package/dist/esm/src/index.js +2 -1
- package/dist/esm/src/index.js.map +1 -1
- package/dist/esm/src/line/constants.js +2 -0
- package/dist/esm/src/line/constants.js.map +1 -0
- package/dist/esm/src/line/index.js +6 -0
- package/dist/esm/src/line/index.js.map +1 -0
- package/dist/esm/src/line/pdfRender.js +16 -0
- package/dist/esm/src/line/pdfRender.js.map +1 -0
- package/dist/esm/src/line/propPanel.js +32 -0
- package/dist/esm/src/line/propPanel.js.map +1 -0
- package/dist/esm/src/line/types.js +2 -0
- package/dist/esm/src/line/types.js.map +1 -0
- package/dist/esm/src/line/uiRender.js +13 -0
- package/dist/esm/src/line/uiRender.js.map +1 -0
- package/dist/esm/src/renderUtils.js +27 -2
- package/dist/esm/src/renderUtils.js.map +1 -1
- package/dist/esm/src/text/index.js.map +1 -1
- package/dist/esm/src/text/pdfRender.js +5 -28
- package/dist/esm/src/text/pdfRender.js.map +1 -1
- package/dist/esm/src/text/propPanel.js +2 -2
- package/dist/esm/src/text/propPanel.js.map +1 -1
- package/dist/esm/src/text/uiRender.js +12 -16
- package/dist/esm/src/text/uiRender.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -1
- package/dist/types/src/line/constants.d.ts +1 -0
- package/dist/types/src/line/index.d.ts +4 -0
- package/dist/types/src/line/pdfRender.d.ts +3 -0
- package/dist/types/src/line/propPanel.d.ts +3 -0
- package/dist/types/src/line/types.d.ts +4 -0
- package/dist/types/src/line/uiRender.d.ts +3 -0
- package/dist/types/src/renderUtils.d.ts +3 -1
- package/package.json +1 -1
- package/src/barcodes/propPanel.ts +27 -29
- package/src/barcodes/uiRender.ts +4 -6
- package/src/image/pdfRender.ts +1 -0
- package/src/image/uiRender.ts +4 -3
- package/src/index.ts +2 -1
- package/src/line/constants.ts +1 -0
- package/src/line/index.ts +8 -0
- package/src/line/pdfRender.ts +24 -0
- package/src/line/propPanel.ts +34 -0
- package/src/line/types.ts +5 -0
- package/src/line/uiRender.ts +15 -0
- package/src/renderUtils.ts +34 -2
- package/src/text/index.ts +0 -1
- package/src/text/pdfRender.ts +5 -41
- package/src/text/propPanel.ts +2 -2
- package/src/text/uiRender.ts +11 -25
@@ -153,35 +153,33 @@ const getPropPanelByBarcodeType = (barcodeType) => {
|
|
153
153
|
if (!defaults)
|
154
154
|
throw new Error(`[@pdfme/schemas] No default for barcode type ${barcodeType}`);
|
155
155
|
return {
|
156
|
-
schema: ({ i18n }) => {
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
};
|
184
|
-
},
|
156
|
+
schema: ({ i18n }) => ({
|
157
|
+
barColor: {
|
158
|
+
title: i18n('schemas.barcodes.barColor'),
|
159
|
+
type: 'string',
|
160
|
+
widget: 'color',
|
161
|
+
rules: [
|
162
|
+
{
|
163
|
+
pattern: constants_js_2.HEX_COLOR_PATTERN,
|
164
|
+
message: i18n('hexColorPrompt'),
|
165
|
+
},
|
166
|
+
],
|
167
|
+
},
|
168
|
+
backgroundColor: {
|
169
|
+
title: i18n('schemas.bgColor'),
|
170
|
+
type: 'string',
|
171
|
+
widget: 'color',
|
172
|
+
rules: [
|
173
|
+
{
|
174
|
+
pattern: constants_js_2.HEX_COLOR_PATTERN,
|
175
|
+
message: i18n('hexColorPrompt'),
|
176
|
+
},
|
177
|
+
],
|
178
|
+
},
|
179
|
+
...(barcodeHasText
|
180
|
+
? { textColor: { title: i18n('schemas.textColor'), type: 'string', widget: 'color' } }
|
181
|
+
: {}),
|
182
|
+
}),
|
185
183
|
...defaults,
|
186
184
|
};
|
187
185
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/barcodes/propPanel.ts"],"names":[],"mappings":";;;AAEA,iDAAiF;AACjF,kDAAqE;AAErE,MAAM,aAAa,GAAG;IACpB,eAAe,EAAE,uCAAwB;IACzC,QAAQ,EAAE,oCAAqB;CAChC,CAAC;AACF,MAAM,iBAAiB,GAAG,EAAE,SAAS,EAAE,oCAAqB,EAAE,CAAC;AAC/D,MAAM,QAAQ,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC;AAChC,MAAM,YAAY,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC;AAE/C,MAAM,eAAe,GAA6D;IAChF;QACE,YAAY,EAAE,oBAAoB;QAClC,aAAa,EAAE;YACb,IAAI,EAAE,QAAQ;YACd,QAAQ;YACR,GAAG,aAAa;YAChB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;IACD;QACE,YAAY,EAAE,kBAAkB;QAChC,aAAa,EAAE;YACb,IAAI,EAAE,WAAW;YACjB,QAAQ;YACR,GAAG,aAAa;YAChB,GAAG,iBAAiB;YACpB,KAAK,EAAE,EAAE;YACT,MAAM,EAAE,GAAG;YACX,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;IACD;QACE,YAAY,EAAE,eAAe;QAC7B,aAAa,EAAE;YACb,IAAI,EAAE,OAAO;YACb,QAAQ;YACR,GAAG,aAAa;YAChB,GAAG,iBAAiB;YACpB,GAAG,YAAY;YACf,MAAM,EAAE,EAAE;YACV,MAAM,EAAE,CAAC;YACT,OAAO,EAAE,8BAAe;SACzB;KACF;IACD;QACE,YAAY,EAAE,UAA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AAE,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC;IAEjG,IAAI,CAAC,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,gDAAgD,WAAW,EAAE,CAAC,CAAC;IAE9F,OAAO;QACL,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACrB,QAAQ,EAAE;gBACR,KAAK,EAAE,IAAI,CAAC,2BAA2B,CAAC;gBACxC,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,gCAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;YACD,eAAe,EAAE;gBACf,KAAK,EAAE,IAAI,CAAC,iBAAiB,CAAC;gBAC9B,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,gCAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;YACD,GAAG,CAAC,cAAc;gBAChB,CAAC,CAAC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,mBAAmB,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;gBACtF,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;QACF,GAAG,QAAQ;KACZ,CAAC;AACJ,CAAC,CAAC;AArCW,QAAA,yBAAyB,6BAqCpC"}
|
@@ -63,7 +63,7 @@ const uiRender = async (arg) => {
|
|
63
63
|
};
|
64
64
|
Object.assign(container.style, containerStyle);
|
65
65
|
rootElement.appendChild(container);
|
66
|
-
const editable =
|
66
|
+
const editable = (0, renderUtils_js_1.isEditable)(mode);
|
67
67
|
if (editable) {
|
68
68
|
const input = document.createElement('input');
|
69
69
|
const inputStyle = {
|
@@ -90,10 +90,8 @@ const uiRender = async (arg) => {
|
|
90
90
|
stopEditing && stopEditing();
|
91
91
|
});
|
92
92
|
container.appendChild(input);
|
93
|
-
|
94
|
-
|
95
|
-
input.focus();
|
96
|
-
}
|
93
|
+
input.setSelectionRange(value.length, value.length);
|
94
|
+
input.focus();
|
97
95
|
}
|
98
96
|
if (!value)
|
99
97
|
return;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/barcodes/uiRender.ts"],"names":[],"mappings":";;;AAGA,2CAAkE;AAClE,
|
1
|
+
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/barcodes/uiRender.ts"],"names":[],"mappings":";;;AAGA,2CAAkE;AAClE,sDAA8D;AAE9D,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACjC,MAAM,SAAS,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAChD,MAAM,cAAc,GAAmB;QACrC,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,GAAG,QAAQ;KACZ,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;IAE/C,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAmB;QAChC,KAAK,EAAE,OAAO;QACd,UAAU,EAAE,KAAK;QACjB,OAAO,EAAE,SAAS;QAClB,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,MAAM;QAClB,YAAY,EAAE,KAAK;KACpB,CAAC;IACF,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IAErC,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC;IAC3B,SAAS,CAA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 +5,8 @@ const renderUtils_js_1 = require("../renderUtils.js");
|
|
5
5
|
const getCacheKey = (schema, input) => `${schema.type}${input}`;
|
6
6
|
const pdfRender = async (arg) => {
|
7
7
|
const { value, schema, pdfDoc, page, _cache } = arg;
|
8
|
+
if (!value || !value.startsWith('data:image/'))
|
9
|
+
return;
|
8
10
|
const inputImageCacheKey = getCacheKey(schema, value);
|
9
11
|
let image = _cache.get(inputImageCacheKey);
|
10
12
|
if (!image) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/image/pdfRender.ts"],"names":[],"mappings":";;;AAEA,sDAA6D;AAE7D,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;AAEzE,MAAM,SAAS,GAAG,KAAK,EAAE,GAAgC,EAAE,EAAE;IAClE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;
|
1
|
+
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/image/pdfRender.ts"],"names":[],"mappings":";;;AAEA,sDAA6D;AAE7D,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,KAAa,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC,IAAI,GAAG,KAAK,EAAE,CAAC;AAEzE,MAAM,SAAS,GAAG,KAAK,EAAE,GAAgC,EAAE,EAAE;IAClE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACpD,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC;QAAE,OAAO;IAEvD,MAAM,kBAAkB,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC;IAC3C,IAAI,CAAC,KAAK,EAAE;QACV,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC;QAClD,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QACxE,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,KAAK,CAAC,CAAC;KACvC;IAED,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,IAAA,yCAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AAClE,CAAC,CAAC;AAtBW,QAAA,SAAS,aAsBpB"}
|
@@ -30,12 +30,13 @@ const readFile = (input) => new Promise((resolve, reject) => {
|
|
30
30
|
});
|
31
31
|
const uiRender = async (arg) => {
|
32
32
|
const { value, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, schema, theme } = arg;
|
33
|
-
const editable =
|
33
|
+
const editable = (0, renderUtils_js_1.isEditable)(mode);
|
34
34
|
const size = { width: schema.width * common_1.ZOOM, height: schema.height * common_1.ZOOM };
|
35
35
|
const container = document.createElement('div');
|
36
|
+
const backgroundStyle = placeholder ? `url(${placeholder})` : 'none';
|
36
37
|
const containerStyle = {
|
37
38
|
...fullSize,
|
38
|
-
backgroundImage: value ? 'none' :
|
39
|
+
backgroundImage: value ? 'none' : backgroundStyle,
|
39
40
|
backgroundSize: `${size.width}px ${size.height}px`,
|
40
41
|
opacity: schema.opacity,
|
41
42
|
};
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/image/uiRender.ts"],"names":[],"mappings":";;;AAGA,0CAAoD;AACpD,
|
1
|
+
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/image/uiRender.ts"],"names":[],"mappings":";;;AAGA,0CAAoD;AACpD,sDAA8D;AAE9D,MAAM,QAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAEnD,MAAM,QAAQ,GAAG,CAAC,KAA6B,EAAiC,EAAE,CAChF,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC9B,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC;IAEpC,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE;QACxB,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE;YACpB,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;SAC1B;IACH,CAAC,CAAC;IAEF,UAAU,CAAC,OAAO,GAAG,CAAC,CAAC,EAAE,EAAE;QACzB,MAAM,CAAC,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC,CAAC;IAC5D,CAAC,CAAC;IAEF,IAAI,IAAI,GAAgB,IAAI,CAAC;IAC7B,IAAI,KAAK,YAAY,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QACjD,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;KACjB;SAAM,IAAI,KAAK,YAAY,IAAI,EAAE;QAChC,IAAI,GAAG,KAAK,CAAC;KACd;IAED,IAAI,IAAI,EAAE;QACR,UAAU,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;KAChC;SAAM;QACL,MAAM,CAAC,IAAI,KAAK,CAAC,oCAAoC,CA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AAC;KAC1B;AACH,CAAC,CAAC;AArFW,QAAA,QAAQ,YAqFnB"}
|
package/dist/cjs/src/index.js
CHANGED
@@ -3,13 +3,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.rotatePoint = exports.convertForPdfLayoutProps = exports.builtInPlugins = exports.barcodes = exports.image = exports.text = void 0;
|
6
|
+
exports.rotatePoint = exports.convertForPdfLayoutProps = exports.builtInPlugins = exports.line = exports.barcodes = exports.image = exports.text = void 0;
|
7
7
|
const index_js_1 = __importDefault(require("./text/index.js"));
|
8
8
|
exports.text = index_js_1.default;
|
9
9
|
const index_js_2 = __importDefault(require("./image/index.js"));
|
10
10
|
exports.image = index_js_2.default;
|
11
11
|
const index_js_3 = __importDefault(require("./barcodes/index.js"));
|
12
12
|
exports.barcodes = index_js_3.default;
|
13
|
+
const index_js_4 = __importDefault(require("./line/index.js"));
|
14
|
+
exports.line = index_js_4.default;
|
13
15
|
const renderUtils_js_1 = require("./renderUtils.js");
|
14
16
|
Object.defineProperty(exports, "convertForPdfLayoutProps", { enumerable: true, get: function () { return renderUtils_js_1.convertForPdfLayoutProps; } });
|
15
17
|
Object.defineProperty(exports, "rotatePoint", { enumerable: true, get: function () { return renderUtils_js_1.rotatePoint; } });
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAmC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,+DAAmC;AAQ1B,eARF,kBAAI,CAQE;AAPb,gEAAqC;AAOtB,gBAPR,kBAAK,CAOQ;AANpB,mEAA2C;AAMrB,mBANf,kBAAQ,CAMe;AAL9B,+DAAmC;AAKH,eALzB,kBAAI,CAKyB;AAJpC,qDAAyE;AAInB,yGAJ7C,yCAAwB,OAI6C;AAAE,4FAJ7C,4BAAW,OAI6C;AAF3F,MAAM,cAAc,GAAG,EAAE,IAAI,EAAE,kBAAI,EAAE,CAAC;AAEA,wCAAc"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../src/line/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG,SAAS,CAAC"}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
const pdfRender_js_1 = require("./pdfRender.js");
|
4
|
+
const propPanel_js_1 = require("./propPanel.js");
|
5
|
+
const uiRender_js_1 = require("./uiRender.js");
|
6
|
+
const schema = { pdf: pdfRender_js_1.pdfRender, ui: uiRender_js_1.uiRender, propPanel: propPanel_js_1.propPanel };
|
7
|
+
exports.default = schema;
|
8
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/line/index.ts"],"names":[],"mappings":";;AACA,iDAA2C;AAC3C,iDAA2C;AAC3C,+CAAyC;AAGzC,MAAM,MAAM,GAAuB,EAAE,GAAG,EAAE,wBAAS,EAAE,EAAE,EAAE,sBAAQ,EAAE,SAAS,EAAT,wBAAS,EAAE,CAAC;AAC/E,kBAAe,MAAM,CAAC"}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.pdfRender = void 0;
|
4
|
+
const renderUtils_js_1 = require("../renderUtils.js");
|
5
|
+
const constants_js_1 = require("./constants.js");
|
6
|
+
const pdfRender = (arg) => {
|
7
|
+
const { page, schema } = arg;
|
8
|
+
const pageHeight = page.getHeight();
|
9
|
+
const { width, height, rotate, position: { x, y }, opacity, } = (0, renderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
|
10
|
+
const pivot = { x: x + width / 2, y: y + height / 2 };
|
11
|
+
page.drawLine({
|
12
|
+
start: (0, renderUtils_js_1.rotatePoint)({ x, y: y + height / 2 }, pivot, rotate.angle),
|
13
|
+
end: (0, renderUtils_js_1.rotatePoint)({ x: x + width, y: y + height / 2 }, pivot, rotate.angle),
|
14
|
+
thickness: height,
|
15
|
+
color: (0, renderUtils_js_1.hex2RgbColor)(schema.color ?? constants_js_1.DEFAULT_LINE_COLOR),
|
16
|
+
opacity: opacity,
|
17
|
+
});
|
18
|
+
};
|
19
|
+
exports.pdfRender = pdfRender;
|
20
|
+
//# sourceMappingURL=pdfRender.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/line/pdfRender.ts"],"names":[],"mappings":";;;AAEA,sDAAwF;AACxF,iDAAoD;AAE7C,MAAM,SAAS,GAAG,CAAC,GAA+B,EAAE,EAAE;IAC3D,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IAC7B,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACpC,MAAM,EACJ,KAAK,EACL,MAAM,EACN,MAAM,EACN,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,EAClB,OAAO,GACR,GAAG,IAAA,yCAAwB,EAAC,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,KAAK,EAAE,CAAC,CAAC;IAClF,MAAM,KAAK,GAAG,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC;IACtD,IAAI,CAAC,QAAQ,CAAC;QACZ,KAAK,EAAE,IAAA,4BAAW,EAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QACjE,GAAG,EAAE,IAAA,4BAAW,EAAC,EAAE,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;QAC1E,SAAS,EAAE,MAAM;QACjB,KAAK,EAAE,IAAA,6BAAY,EAAC,MAAM,CAAC,KAAK,IAAI,iCAAkB,CAAC;QACvD,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;AACL,CAAC,CAAC;AAlBW,QAAA,SAAS,aAkBpB"}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.propPanel = void 0;
|
4
|
+
const constants_js_1 = require("../constants.js");
|
5
|
+
const constants_js_2 = require("./constants.js");
|
6
|
+
exports.propPanel = {
|
7
|
+
schema: ({ i18n }) => {
|
8
|
+
return {
|
9
|
+
color: {
|
10
|
+
title: i18n('schemas.line.color'),
|
11
|
+
type: 'string',
|
12
|
+
widget: 'color',
|
13
|
+
required: true,
|
14
|
+
rules: [
|
15
|
+
{
|
16
|
+
pattern: constants_js_1.HEX_COLOR_PATTERN,
|
17
|
+
message: i18n('hexColorPrompt'),
|
18
|
+
},
|
19
|
+
],
|
20
|
+
},
|
21
|
+
};
|
22
|
+
},
|
23
|
+
defaultValue: '',
|
24
|
+
defaultSchema: {
|
25
|
+
type: 'line',
|
26
|
+
position: { x: 0, y: 0 },
|
27
|
+
width: 50,
|
28
|
+
height: 1,
|
29
|
+
rotate: 0,
|
30
|
+
opacity: 1,
|
31
|
+
readOnly: true,
|
32
|
+
color: constants_js_2.DEFAULT_LINE_COLOR,
|
33
|
+
},
|
34
|
+
};
|
35
|
+
//# sourceMappingURL=propPanel.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/line/propPanel.ts"],"names":[],"mappings":";;;AAEA,kDAAoD;AACpD,iDAAoD;AAEvC,QAAA,SAAS,GAA0B;IAC9C,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE;QACnB,OAAO;YACL,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI,CAAC,oBAAoB,CAAC;gBACjC,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,OAAO;gBACf,QAAQ,EAAE,IAAI;gBACd,KAAK,EAAE;oBACL;wBACE,OAAO,EAAE,gCAAiB;wBAC1B,OAAO,EAAE,IAAI,CAAC,gBAAgB,CAAC;qBAChC;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IACD,YAAY,EAAE,EAAE;IAChB,aAAa,EAAE;QACb,IAAI,EAAE,MAAM;QACZ,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE;QACxB,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;QACT,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,IAAI;QACd,KAAK,EAAE,iCAAkB;KAC1B;CACF,CAAC"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/line/types.ts"],"names":[],"mappings":""}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.uiRender = void 0;
|
4
|
+
const constants_js_1 = require("./constants.js");
|
5
|
+
const uiRender = (arg) => {
|
6
|
+
const { schema, rootElement } = arg;
|
7
|
+
const div = document.createElement('div');
|
8
|
+
div.style.backgroundColor = schema.color ?? constants_js_1.DEFAULT_LINE_COLOR;
|
9
|
+
div.style.width = '100%';
|
10
|
+
div.style.height = '100%';
|
11
|
+
if (schema.opacity !== undefined) {
|
12
|
+
div.style.opacity = `${schema.opacity}`;
|
13
|
+
}
|
14
|
+
rootElement.appendChild(div);
|
15
|
+
};
|
16
|
+
exports.uiRender = uiRender;
|
17
|
+
//# sourceMappingURL=uiRender.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"uiRender.js","sourceRoot":"","sources":["../../../../src/line/uiRender.ts"],"names":[],"mappings":";;;AAEA,iDAAoD;AAE7C,MAAM,QAAQ,GAAG,CAAC,GAA8B,EAAE,EAAE;IACzD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;IACpC,MAAM,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1C,GAAG,CAAC,KAAK,CAAC,eAAe,GAAG,MAAM,CAAC,KAAK,IAAI,iCAAkB,CAAC;IAC/D,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC;IACzB,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;IAC1B,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,EAAE;QAChC,GAAG,CAAC,KAAK,CAAC,OAAO,GAAG,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;KACzC;IACD,WAAW,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC,CAAC;AAVW,QAAA,QAAQ,YAUnB"}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.addAlphaToHex = exports.rotatePoint = exports.convertForPdfLayoutProps = void 0;
|
3
|
+
exports.hex2RgbColor = exports.isEditable = exports.addAlphaToHex = exports.rotatePoint = exports.convertForPdfLayoutProps = void 0;
|
4
4
|
const pdf_lib_1 = require("@pdfme/pdf-lib");
|
5
5
|
const common_1 = require("@pdfme/common");
|
6
6
|
const convertForPdfLayoutProps = ({ schema, pageHeight, applyRotateTranslate = true, }) => {
|
@@ -56,4 +56,31 @@ const addAlphaToHex = (hex, alphaPercentage) => {
|
|
56
56
|
return hex + alphaHex;
|
57
57
|
};
|
58
58
|
exports.addAlphaToHex = addAlphaToHex;
|
59
|
+
const isEditable = (mode) => mode === 'form' || mode === 'designer';
|
60
|
+
exports.isEditable = isEditable;
|
61
|
+
const hex2rgb = (hex) => {
|
62
|
+
if (hex.slice(0, 1) === '#')
|
63
|
+
hex = hex.slice(1);
|
64
|
+
if (hex.length === 3)
|
65
|
+
hex =
|
66
|
+
hex.slice(0, 1) +
|
67
|
+
hex.slice(0, 1) +
|
68
|
+
hex.slice(1, 2) +
|
69
|
+
hex.slice(1, 2) +
|
70
|
+
hex.slice(2, 3) +
|
71
|
+
hex.slice(2, 3);
|
72
|
+
return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map((str) => parseInt(str, 16));
|
73
|
+
};
|
74
|
+
const hex2RgbColor = (hexString) => {
|
75
|
+
if (hexString) {
|
76
|
+
const isValid = (0, common_1.isHexValid)(hexString);
|
77
|
+
if (!isValid) {
|
78
|
+
throw new Error(`Invalid hex color value ${hexString}`);
|
79
|
+
}
|
80
|
+
const [r, g, b] = hex2rgb(hexString);
|
81
|
+
return (0, pdf_lib_1.rgb)(r / 255, g / 255, b / 255);
|
82
|
+
}
|
83
|
+
return undefined;
|
84
|
+
};
|
85
|
+
exports.hex2RgbColor = hex2RgbColor;
|
59
86
|
//# sourceMappingURL=renderUtils.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"renderUtils.js","sourceRoot":"","sources":["../../../src/renderUtils.ts"],"names":[],"mappings":";;;AAAA,
|
1
|
+
{"version":3,"file":"renderUtils.js","sourceRoot":"","sources":["../../../src/renderUtils.ts"],"names":[],"mappings":";;;AAAA,4CAAgE;AAChE,0CAAgE;AAEzD,MAAM,wBAAwB,GAAG,CAAC,EACvC,MAAM,EACN,UAAU,EACV,oBAAoB,GAAG,IAAI,GAK5B,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,GAA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CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;QAErC,OAAO,IAAA,aAAG,EAAC,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC;KACvC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAdW,QAAA,YAAY,gBAcvB"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/text/index.ts"],"names":[],"mappings":";;AACA,iDAA2C;AAC3C,iDAA2C;AAC3C,+CAAyC;AAGzC,MAAM,MAAM,GAAuB,EAAE,GAAG,EAAE,wBAAS,EAAE,EAAE,EAAE,sBAAQ,EAAE,SAAS,EAAT,wBAAS,EAAE,CAAC;
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/text/index.ts"],"names":[],"mappings":";;AACA,iDAA2C;AAC3C,iDAA2C;AAC3C,+CAAyC;AAGzC,MAAM,MAAM,GAAuB,EAAE,GAAG,EAAE,wBAAS,EAAE,EAAE,EAAE,sBAAQ,EAAE,SAAS,EAAT,wBAAS,EAAE,CAAC;AAC/E,kBAAe,MAAM,CAAC"}
|
@@ -1,35 +1,10 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.pdfRender = void 0;
|
4
|
-
const pdf_lib_1 = require("@pdfme/pdf-lib");
|
5
4
|
const common_1 = require("@pdfme/common");
|
6
5
|
const constants_js_1 = require("./constants.js");
|
7
6
|
const helper_js_1 = require("./helper.js");
|
8
7
|
const renderUtils_js_1 = require("../renderUtils.js");
|
9
|
-
const hex2rgb = (hex) => {
|
10
|
-
if (hex.slice(0, 1) === '#')
|
11
|
-
hex = hex.slice(1);
|
12
|
-
if (hex.length === 3)
|
13
|
-
hex =
|
14
|
-
hex.slice(0, 1) +
|
15
|
-
hex.slice(0, 1) +
|
16
|
-
hex.slice(1, 2) +
|
17
|
-
hex.slice(1, 2) +
|
18
|
-
hex.slice(2, 3) +
|
19
|
-
hex.slice(2, 3);
|
20
|
-
return [hex.slice(0, 2), hex.slice(2, 4), hex.slice(4, 6)].map((str) => parseInt(str, 16));
|
21
|
-
};
|
22
|
-
const hex2RgbColor = (hexString) => {
|
23
|
-
if (hexString) {
|
24
|
-
const isValid = (0, common_1.isHexValid)(hexString);
|
25
|
-
if (!isValid) {
|
26
|
-
throw new Error(`Invalid hex color value ${hexString}`);
|
27
|
-
}
|
28
|
-
const [r, g, b] = hex2rgb(hexString);
|
29
|
-
return (0, pdf_lib_1.rgb)(r / 255, g / 255, b / 255);
|
30
|
-
}
|
31
|
-
return undefined;
|
32
|
-
};
|
33
8
|
const embedAndGetFontObj = async (arg) => {
|
34
9
|
const { pdfDoc, font, _cache } = arg;
|
35
10
|
if (_cache.has(pdfDoc)) {
|
@@ -52,7 +27,7 @@ const getFontProp = async ({ value, font, schema, _cache, }) => {
|
|
52
27
|
const fontSize = schema.dynamicFontSize
|
53
28
|
? await (0, helper_js_1.calculateDynamicFontSize)({ textSchema: schema, font, value, _cache })
|
54
29
|
: schema.fontSize ?? constants_js_1.DEFAULT_FONT_SIZE;
|
55
|
-
const color = hex2RgbColor(schema.fontColor || constants_js_1.DEFAULT_FONT_COLOR);
|
30
|
+
const color = (0, renderUtils_js_1.hex2RgbColor)(schema.fontColor || constants_js_1.DEFAULT_FONT_COLOR);
|
56
31
|
return {
|
57
32
|
alignment: schema.alignment ?? constants_js_1.DEFAULT_ALIGNMENT,
|
58
33
|
verticalAlignment: schema.verticalAlignment ?? constants_js_1.DEFAULT_VERTICAL_ALIGNMENT,
|
@@ -64,6 +39,8 @@ const getFontProp = async ({ value, font, schema, _cache, }) => {
|
|
64
39
|
};
|
65
40
|
const pdfRender = async (arg) => {
|
66
41
|
const { value, pdfDoc, pdfLib, page, options, schema, _cache } = arg;
|
42
|
+
if (!value)
|
43
|
+
return;
|
67
44
|
const { font = (0, common_1.getDefaultFont)() } = options;
|
68
45
|
const [pdfFontObj, fontKitFont, fontProp] = await Promise.all([
|
69
46
|
embedAndGetFontObj({ pdfDoc, font, _cache }),
|
@@ -72,11 +49,11 @@ const pdfRender = async (arg) => {
|
|
72
49
|
]);
|
73
50
|
const { fontSize, color, alignment, verticalAlignment, lineHeight, characterSpacing } = fontProp;
|
74
51
|
const fontName = (schema.fontName ? schema.fontName : (0, common_1.getFallbackFontName)(font));
|
75
|
-
const pdfFontValue = pdfFontObj[fontName];
|
52
|
+
const pdfFontValue = pdfFontObj && pdfFontObj[fontName];
|
76
53
|
const pageHeight = page.getHeight();
|
77
54
|
const { width, height, rotate, position: { x, y }, opacity, } = (0, renderUtils_js_1.convertForPdfLayoutProps)({ schema, pageHeight, applyRotateTranslate: false });
|
78
55
|
if (schema.backgroundColor) {
|
79
|
-
const color = hex2RgbColor(schema.backgroundColor);
|
56
|
+
const color = (0, renderUtils_js_1.hex2RgbColor)(schema.backgroundColor);
|
80
57
|
page.drawRectangle({ x, y, width, height, rotate, color });
|
81
58
|
}
|
82
59
|
page.pushOperators(pdfLib.setCharacterSpacing(characterSpacing ?? constants_js_1.DEFAULT_CHARACTER_SPACING));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/text/pdfRender.ts"],"names":[],"mappings":";;;
|
1
|
+
{"version":3,"file":"pdfRender.js","sourceRoot":"","sources":["../../../../src/text/pdfRender.ts"],"names":[],"mappings":";;;AACA,0CAAiG;AAEjG,iDAUwB;AACxB,2CAOqB;AACrB,sDAAwF;AAExF,MAAM,kBAAkB,GAAG,KAAK,EAAE,GAIjC,EAAE,EAAE;IACH,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;IACrC,IAAI,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE;QACtB,OAAO,MAAM,CAAC,GAAG,CAAC,MAAM,CAA+B,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,EAAE;YAC1B,KAAK,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;SAClC;aAAM,IAAI,SAAS,KAAK,OAAO,EAAE;YAChC,KAAK,IAAI,KAAK,GAAG,SAAS,CAAC;SAC5B;QAED,IAAI,KAAK,GAAG,UAAU,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,UAAU,CAAC;QAEzE,IAAI,MAAM,CAAC,KAAK,KAAK,CAAC,EAAE;YACtB,iGAAiG;YACjG,qGAAqG;YACrG,MAAM,YAAY,GAAG,IAAA,4BAAW,EAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;YACnF,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC;YACvB,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC;SACxB;QAED,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE;YAClB,CAAC,EAAE,KAAK;YACR,CAAC,EAAE,KAAK;YACR,MAAM;YACN,IAAI,EAAE,QAAQ;YACd,KAAK;YACL,UAAU,EAAE,UAAU,GAAG,QAAQ;YACjC,QAAQ,EAAE,KAAK;YACf,IAAI,EAAE,YAAY;YAClB,UAAU,EAAE,CAAC,EAAE,CAAC;YAChB,OAAO;SACR,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAtGW,QAAA,SAAS,aAsGpB"}
|
@@ -127,7 +127,7 @@ exports.propPanel = {
|
|
127
127
|
rules: [
|
128
128
|
{
|
129
129
|
pattern: constants_js_2.HEX_COLOR_PATTERN,
|
130
|
-
message: '
|
130
|
+
message: i18n('hexColorPrompt'),
|
131
131
|
},
|
132
132
|
],
|
133
133
|
},
|
@@ -138,7 +138,7 @@ exports.propPanel = {
|
|
138
138
|
rules: [
|
139
139
|
{
|
140
140
|
pattern: constants_js_2.HEX_COLOR_PATTERN,
|
141
|
-
message: '
|
141
|
+
message: i18n('hexColorPrompt'),
|
142
142
|
},
|
143
143
|
],
|
144
144
|
},
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"propPanel.js","sourceRoot":"","sources":["../../../../src/text/propPanel.ts"],"names":[],"mappings":";;;AAAA,0CAMuB;AAEvB,iDAiBwB;AACxB,kDAAqE;AAErE,MAAM,kBAAkB,GAAG,CAAC,KAA2B,EAAE,EAAE;IACzD,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IAEjE,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IACjD,QAAQ,CAAC,IAAI,GAAG,UAAU,CAAC;IAC3B,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAE,YAAoB,EAAE,eAAe,CAAC,CAAC;IACnE,QAAQ,CAAC,QAAQ,GAAG,CAAC,CAAM,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO;YAC1B,CAAC,CAAC;gBACE,GAAG,EAAE,4CAA6B;gBAClC,GAAG,EAAE,4CAA6B;gBAClC,GAAG,EAAE,kCAAmB;aACzB;YACH,CAAC,CAAC,SAAS,CAAC;QACd,aAAa,CAAC,CAAC,EAAE,GAAG,EAAE,iBAAiB,EAAE,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,YAAY,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;IACrF,CAAC,CAAC;IACF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,8BAA8B,CAAC,IAAI,EAAE,CAAC;IAC7D,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,6BAA6B,CAAC;IACpD,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC5B,WAAW,CA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CAAyB;QAC3C,eAAe,EAAE,SAAS;QAC1B,SAAS,EAAE,iCAAkB;QAC7B,QAAQ,EAAE,SAAS;QACnB,eAAe,EAAE,EAAE;QACnB,OAAO,EAAE,8BAAe;KACzB;CACF,CAAC"}
|
@@ -17,16 +17,12 @@ const mapVerticalAlignToFlex = (verticalAlignmentValue) => {
|
|
17
17
|
}
|
18
18
|
return 'flex-start';
|
19
19
|
};
|
20
|
-
const getBackgroundColor = (
|
21
|
-
if (
|
20
|
+
const getBackgroundColor = (value, schema, defaultBackgroundColor) => {
|
21
|
+
if (!value)
|
22
|
+
return 'transparent';
|
23
|
+
if (schema.backgroundColor)
|
22
24
|
return schema.backgroundColor;
|
23
|
-
|
24
|
-
else if (mode === 'viewer') {
|
25
|
-
return schema.backgroundColor ?? 'transparent';
|
26
|
-
}
|
27
|
-
else {
|
28
|
-
return defaultBackgroundColor;
|
29
|
-
}
|
25
|
+
return defaultBackgroundColor;
|
30
26
|
};
|
31
27
|
const uiRender = async (arg) => {
|
32
28
|
const { value, schema, rootElement, mode, onChange, stopEditing, tabIndex, placeholder, options, theme, _cache, } = arg;
|
@@ -52,7 +48,7 @@ const uiRender = async (arg) => {
|
|
52
48
|
const containerStyle = {
|
53
49
|
padding: 0,
|
54
50
|
resize: 'none',
|
55
|
-
backgroundColor: getBackgroundColor(
|
51
|
+
backgroundColor: getBackgroundColor(value, schema, (0, renderUtils_js_1.addAlphaToHex)(theme.colorPrimaryBg, 30)),
|
56
52
|
border: 'none',
|
57
53
|
display: 'flex',
|
58
54
|
flexDirection: 'column',
|
@@ -78,13 +74,13 @@ const uiRender = async (arg) => {
|
|
78
74
|
resize: 'none',
|
79
75
|
border: 'none',
|
80
76
|
outline: 'none',
|
81
|
-
marginBottom: bottomAdjustment
|
82
|
-
paddingTop: topAdjustment
|
77
|
+
marginBottom: `${bottomAdjustment}px`,
|
78
|
+
paddingTop: `${topAdjustment}px`,
|
83
79
|
backgroundColor: 'transparent',
|
84
80
|
};
|
85
81
|
const textBlock = document.createElement('div');
|
86
82
|
Object.assign(textBlock.style, textBlockStyle);
|
87
|
-
if (
|
83
|
+
if ((0, renderUtils_js_1.isEditable)(mode)) {
|
88
84
|
textBlock.contentEditable = 'plaintext-only';
|
89
85
|
textBlock.tabIndex = tabIndex || 0;
|
90
86
|
textBlock.innerText = value;
|
@@ -101,8 +97,8 @@ const uiRender = async (arg) => {
|
|
101
97
|
dynamicFontSize = await (0, helper_js_1.calculateDynamicFontSize)(getCdfArg(textBlock.textContent));
|
102
98
|
textBlock.style.fontSize = `${dynamicFontSize}pt`;
|
103
99
|
const { topAdj: newTopAdj, bottomAdj: newBottomAdj } = (0, helper_js_1.getBrowserVerticalFontAdjustments)(fontKitFont, dynamicFontSize ?? schema.fontSize ?? constants_js_1.DEFAULT_FONT_SIZE, schema.lineHeight ?? constants_js_1.DEFAULT_LINE_HEIGHT, schema.verticalAlignment ?? constants_js_1.DEFAULT_VERTICAL_ALIGNMENT);
|
104
|
-
textBlock.style.paddingTop = newTopAdj
|
105
|
-
textBlock.style.marginBottom = newBottomAdj
|
100
|
+
textBlock.style.paddingTop = `${newTopAdj}px`;
|
101
|
+
textBlock.style.marginBottom = `${newBottomAdj}px`;
|
106
102
|
})();
|
107
103
|
}, 0);
|
108
104
|
});
|